require "step"
require "snippet"

module LWA
  class Conditional

    attr_reader :condition_step, :content_steps

    def initialize(conditional_element)
      @conditional_element = conditional_element
      @condition_step = Step.new(@conditional_element)
      @content_steps = create_content_steps
    end

    private

    def create_content_steps
      step_list = Array.new
      @conditional_element.elements.each do |element|
        case element.name
        when /Step/
          step_list.push(Step.new(element))
        when /Snippet/
          step_list.push(Snippet.new(element))
        when /Conditional/
          step_list.push(Conditional.new(element))
        end
      end
      return step_list
    end

  end
end